package com.ipartek.pruebas.bbdd;

import java.util.Iterator;
import java.util.List;

import com.ipartek.pruebas.bean.Alumno;
import com.ipartek.pruebas.excepciones.AlumnoException;

public class ProbarAlumnoDao {

	
	 
    public static void main(String[] args) {

   	
		   ConnectionFactory conFac = null;
		   AlumnoDAO dao = null; 
		    
		   try{
			   System.out.println("obtener conexion");	
			   conFac = ConnectionFactory.getConnectionFactory( ConnectionFactory.ODBC );
			   
		   }catch ( Exception e){
			   e.printStackTrace();
		   }   
		   
		   
		   dao = conFac.getAlumnoDAO();	   
		   try{
		   		List<Alumno> lista = dao.getAlumnos(); 	
		   		
		   	
			   	Iterator<Alumno> it = lista.iterator();
			   	while ( it.hasNext() ){
			   		Alumno a = it.next();
			   		System.out.println(a);
			   		a=null;
			   	}
			   	
		   	
		   }catch( AlumnoException e ){
			   e.printStackTrace();
		   }
		   	
   	
    }
	
}
